<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->id();
            $table->string('name',100)->default('')->comment('类目名称');
            $table->string('keywords',1000)->default('')->comment('类目关键字，以JSON数组格式');
            $table->string('desc',500)->default('')->comment('类目广告语介绍');
            $table->integer('pid')->default(0)->comment('父类目ID');
            $table->string('icon_url',255)->nullable()->default('')->comment('类目图标');
            $table->string('pic_url',255)->nullable()->default('')->comment('类目图片');
            $table->string('level',255)->nullable()->default('')->comment('层级');
            $table->tinyInteger('sort_order')->nullable()->default(50)->comment('排序');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}
